#define _CRT_SECURE_NO_WARNINGS 1

class Solution {
public:
    int abs(int n)
    {
        return n >= 0 ? n : -n;
    }
    int maxArea(vector<int>& height) {
        int left = 0, right = height.size() - 1;
        int res = 0;
        while (left < right)
        {
            res = max(res, (right - left) * min(height[right], height[left]));
            height[right] > height[left] ? ++left : --right;
        }
        return res;
    }
};